<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> 飛羽主題攝影 </title>
<link href="css/photo.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/btn.css"/>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.cycle.js"></script>
<script type="text/javascript" src="js/slideshow.js"></script>
	<script type="text/javascript">
	$(document).ready(function(){
		$(".hoverNews , .hoverWorking , .hoverGown , .hoverCos , .hoverLogo , .hoverLogo2 , .hoverAbout , .hoverInfor, .hoverOnline , .hoverContact , .hoverlist-topa , .hoverlist-topb").css("opacity","0");
		$(".hoverNews , .hoverWorking , .hoverGown , .hoverCos , .hoverLogo , .hoverLogo2 , .hoverAbout , .hoverInfor, .hoverOnline , .hoverContact , .hoverlist-topa , .hoverlist-topb").hover(function () {
			$(this).stop().animate({
				opacity: 1
			}, "fast");
		},
		function () {
			$(this).stop().animate({
				opacity: 0
			}, "fast");
		});
		});
	</script>
</head>
<body >
<div id="wrap"><!-- start #wrap //-->
<div id="main" class="clearfix"><!-- start #main //-->
<!-- start #top //-->
<?php 
    include_once('top.php');
    include_once('conn.php');
?>
<!-- end #top //-->
<div id="all">

  <div class="photo-tit">
    <p>SHOW ROOM
    </p>
    <p>客戶作品</p>
  </div>
  
  <?php
  $pageSize = 9;
  $nid = 3;
  if (!isset($_REQUEST['page'])) { 
      $_REQUEST['page'] = 1; 
  }

  $sql = sprintf("SELECT * FROM product_type_big where nid = %d LIMIT 1", $nid);
  $result = mysql_query($sql);
  $row = mysql_fetch_assoc($result);
  $bigClassName = $row['BigClassName'];

  if ($_REQUEST['page'] == 1) {
    $sql = sprintf("SELECT * FROM product WHERE BigClassName = '%s' LIMIT %d", mysql_escape_string($bigClassName), $pageSize);
  }else{
    $sql = sprintf("SELECT * FROM product WHERE BigClassName = '%s' LIMIT %d, %d", mysql_escape_string($bigClassName), $pageSize, $_REQUEST['page'] - 1);
  }
  $result = mysql_query($sql);
  while( $row = mysql_fetch_assoc($result)) {
  ?>
     <div class="list-tab2">
<div class="list-p2">
		 <img src="<?php echo $row['images'];?>" width="289" height="193"  />
         <p ><?php echo $row['title']; ?><br />
         拍攝日期：<?php echo date('Y/m/d', strtotime($row['addtime'])); ?></p>
	</div>
     <a href="<?php printf('cos-working2.php?nid=%d&bigClassName=%s&title=%s', $nid, urlencode($row['BigClassName']), urlencode($row['title'])); ?>">
<div class="list-topb"><div class="hoverlist-topb">
<p ><?php echo $row['title']; ?><br />
         拍攝日期：<?php echo date('Y/m/d', strtotime($row['addtime'])); ?></p>
</div></div></a>
  </div>
 <?php } 
 $sql = sprintf("SELECT count(*) as total FROM product WHERE nid = %d", $nid);
 $result = mysql_query($sql);
 $row = mysql_fetch_assoc($result);
 $pages = floor($row['total'] / $pageSize) + 1;
 ?> 
<div id="photo-page">
  <ul>
    <?php 
    if ($_REQUEST['page'] < $pages) { 
        $next = $_REQUEST['page'] + 1;
    ?>
    <li>
        <a href="<?php printf('%s?page=%d', $_SERVER['PHP_SELF'], $next); ?>">
      NEXT
    </a></li>
    <?php } ?>
    <?php 
    if ($_REQUEST['page'] > 1) { 
        $prev = $_REQUEST['page'] - 1;
     ?>
    <li><a href="<?php printf('%s?page=%d', $_SERVER['PHP_SELF'], $prev);?>">
     PREV
    </a></li>
    <?php } ?>
  </ul>
</div>
</div><!-- end #main //-->
</div><!-- end #wrap //-->

<?php include_once('down.php');?>
</body>
</html>
